import React from 'react';
import { hashHistory } from 'react-router';
const calcMoney = (price) => {
  let mixed = price % 100;
  const int = (price - mixed) / 100;
  mixed = (`0${mixed}`).slice(-2);
  // return [int, mixed];
	return int + '.' +mixed;
};
module.exports = [
  {
    key:'dealNum',
    title:'流水号',
    dataType:'varchar',
  },
  // {
  //   key:'orderId',
  //   title:'订单号',
  //   dataType:'varchar',
  //   primary : true,
  //   // render: (text) => {
  //   //   const handleClick = () => {
  //   //     alert('click')
  //   //   }
  //   //   return (<span
  //   //       onClick={handleClick}
  //   //       style={{color: '#108DE9', cursor: 'pointer'}}
  //   //     >{text}</span>)
  //   // }
  // },
  {
    key:'userName',
    title:'姓名',
    dataType:'varchar',
  },
  {
    key:'loadAmount',
    title:'借款金额',
    dataType:'varchar',
    render: (text, row, index) => {
      if(!text)
      return;
        return <span>{calcMoney(text)}元</span>;
    }
  },
  {
    key:'status',
    title:'账单状态',
    dataType:'varchar',
    render: (text) => {
      let showText = '';
      switch (text) {
        case 0:
          showText = '创建';
          break;
        case 1:
          showText = '审核中';
          break;
        case -1:
          showText = '未通过';
          break;
        case 10:
          showText = '完成';
          break;
       
      
        default:
          break;
      }
      return <span>{showText}</span>
    }
  },
  // {
  //   key:'borrowType',
  //   title:'类别',
  //   dataType:'varchar',
  // },
  {
    key:'type',
    title:'类别',
    dataType:'varchar',
    render: (text) => {
      let showText = '';
      switch (text) {
        case '200':
          showText = '小额贷';
          break;
        case '300':
          showText = '闪借贷';
          break;
      
        default:
          break;
      }
      return <span>{showText}</span>
    }
  },
  {
    key:'loadDay',
    title:'分期数',
    dataType:'varchar',
    render: (text) => {
      return <span>{text}天</span>
    }
  },
  {
    key:'payMent',
    title:'还款项',
    dataType:'varchar',
  },
  {
    key:'overdueDay',
    title:'逾期时长',
    dataType:'varchar',
  },
  {
    key:'payAmount',
    title:'应收款',
    dataType:'varchar',
    render: (text, row, index) => {
      if(!text)
      return;
        return <span>{calcMoney(text)}元</span>;
    }
  },
  {
    key:'money',
    title:'实收款',
    dataType:'varchar',
    render: (text, row, index) => {
      if(!text)
      return;
        return <span>{calcMoney(text)}元</span>;
    }
  },
  {
    key:'remaindAmount',
    title:'剩余款',
    dataType:'varchar',
    render: (text, row, index) => {
      if(!text)
      return;
        return <span>{calcMoney(text)}元</span>;
    }
  },
  {
    key:'paymentMethod',
    title:'支付方式',
    dataType:'varchar',
  },
   {
     key:'repayBankCode',
     title:'打款账号',
     dataType:'varchar',
   },
   {
    key:'platform',
    title:'收款渠道',
    dataType:'varchar',
    render: (text) => {
      let showText = ''
      switch (text) {
        case 'ALLIN':
          showText = '通联';
          break;
      
        default:
          break;
      }
    return <span>{showText}</span>
    }
  },
  // {
  //   key:'sourceMoney',
  //   title:'收款渠道',
  //   dataType:'varchar',
  // },
  {
    key:'sourceMoney',
    title:'资金源',
    dataType:'varchar',
  },
  {
    key:'returnTime',
    title:'实际收款时间',
    dataType:'varchar',
    render: (text, row, index) => {
      if(!text)
      return '';
      return new Date(text).format("yyyy-MM-dd HH:mm:ss");
    }
  },
  {
    key:'orderNum',
    title:'订单号',
    dataType:'varchar',
  },
  

  
  {
    key:'baseAmt',
    title:'',
    dataType:'varTable',
    width: 0,
    className: 'disnon-table',
    render: () => {
      
    }
  },
  {
    key:'interestAmt',
    title:'',
    dataType:'varTable',
    width: 0,
    className: 'disnon-table',
    render: () => {
      
    }
  },
  {
    key:'baseRate',
    title:'',
    dataType:'varTable',
    width: 0,
    className: 'disnon-table',
    render: () => {
      
    }
  },
  {
    key:'interestRate',
    title:'',
    dataType:'varTable',
    width: 0,
    className: 'disnon-table',
    render: () => {
      
    }
  },
  {
    key:'overdueFree',
    title:'',
    dataType:'varTable',
    width: 0,
    className: 'disnon-table',
    render: () => {
      
    }
  },
  {
    key:'overdueManageFree',
    title:'',
    dataType:'varTable',
    width: 0,
    className: 'disnon-table',
    render: () => {
      
    }
  },
];